<!--
 * @Author: panghu chenjh@datamargin.com
 * @Date: 2024-04-11 17:22:53
 * @LastEditors: panghu chenjh@datamargin.com
 * @LastEditTime: 2024-05-03 15:17:21
 * @FilePath: \zheye\src\views\home.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="home-page">
    <section class="py-5 text-center container">
      <div class="row py-lg-5">
        <div class="col-lg-6 col-md-8 mx-auto">
          <img src="../assets/callout.svg" alt="callout" class="w-50"/>
          <h2 class="font-weight-light">随心写作，自由表达</h2>
          <p>
            <router-link to="/create" class="btn btn-primary my-2">开始写文章</router-link>
          </p>
        </div>
      </div>
    </section>
    <h4 class="font-weight-bold text-center">发现精彩</h4>
    <ColumnList :list="list" />
    <!-- <button
      class="btn btn-outline-primary mt-2 mb-5 mx-auto btn-block w-25"
    >
      加载更多
    </button> -->
  </div>
</template>

<script lang="ts">
import { defineComponent, computed, onMounted } from 'vue'
import ColumnList from '@/components/ColumnList.vue'
import { useStore } from 'vuex'

export default defineComponent({
  name: 'HomeComp',
  components: { ColumnList },
  setup () {
    const store = useStore()
    onMounted(() => {
      store.dispatch('fetchColumns')
    })
    const list = computed(() => {
      return store.state.columns
    })
    return {
      list
    }
  }
})
</script>

<style scoped>

</style>
